package com.shelpe.services.sinbad;

import java.util.List;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.http.converter.HttpMessageConverter;

import feign.Logger;
import feign.Request.Options;

@Configuration
@EnableFeignClients(basePackages="com.shelpe.services.sinbad.service.simbaproxy")
public class FeignConfiguration {
	@Bean
	public Logger.Level feignLoggerLevel(){
		return Logger.Level.FULL;
	}
	
	@Bean
	public Options feignRequestOptions() {
		return new Options(10 * 1000, 3 * 60 * 1000);
	}
	
	@Bean
	@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
	public FeignSpringFormEncoder encoder(List<HttpMessageConverter> converters) {
		FeignSpringFormEncoder encoder = new FeignSpringFormEncoder();
		encoder.setConverters(converters);
		return encoder;
	}
}
